package tech.client.utils;

import java.io.File;
import java.util.HashMap;
import java.util.Iterator;

import android.app.Activity;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Bitmap.Config;
import android.net.Uri;
import android.provider.MediaStore;

public class FileUtil {
	/** 
	 * 获取文件后缀
	 */
	public static String getExt(String path) {
		return path.substring(path.lastIndexOf('.'));
	}
	public static int computeSampleSize(BitmapFactory.Options options,
			int minSideLength, int maxNumOfPixels) {
		int initialSize = computeInitialSampleSize(options, minSideLength,
				maxNumOfPixels);

		int roundedSize;
		if (initialSize <= 8) {
			roundedSize = 1;
			while (roundedSize < initialSize) {
				roundedSize <<= 1;
			}
		} else {
			roundedSize = (initialSize + 7) / 8 * 8;
		}

		return roundedSize;
	}

	private static int computeInitialSampleSize(BitmapFactory.Options options,
			int minSideLength, int maxNumOfPixels) {
		double w = options.outWidth;
		double h = options.outHeight;

		int lowerBound = (maxNumOfPixels == -1) ? 1 : (int) Math.ceil(Math
				.sqrt(w * h / maxNumOfPixels));
		int upperBound = (minSideLength == -1) ? 128 : (int) Math.min(
				Math.floor(w / minSideLength), Math.floor(h / minSideLength));

		if (upperBound < lowerBound) {
			// return the larger one when there is no overlapping zone.
			return lowerBound;
		}

		if ((maxNumOfPixels == -1) && (minSideLength == -1)) {
			return 1;
		} else if (minSideLength == -1) {
			return lowerBound;
		} else {
			return upperBound;
		}
	}
	public static String getRealPathFromURI(Uri contentUri,Activity activity) {
		String[] proj = { MediaStore.Images.Media.DATA };
		Cursor cursor = activity.managedQuery(contentUri, proj, null, null, null);
		int column_index = cursor
				.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
		cursor.moveToFirst();
		return cursor.getString(column_index);
	}
	@SuppressWarnings("rawtypes")
	public static String getFileType(File paramFile) {
		HashMap mime = initMime();
		int i = paramFile.getName().lastIndexOf(".");
		if (i < 1) {
			i = 0;
		}
		String str1 = paramFile.getName().substring(i);
		String str2 = null;
		int j = 0;
		Iterator localIterator = mime.keySet().iterator();
		while (localIterator.hasNext()) {
			String str3 = (String) localIterator.next();
			if (str1.equalsIgnoreCase(str3)) {
				str2 = (String) mime.get(str3);
				j = 1;
				break;
			}
		}
		if (j == 0) {
			str2 = "*/*";
		}
		return str2;
	}

	public static Bitmap createBitmapWithWatermark(Bitmap photo2,Bitmap watermarkBitmap) {
		int w = photo2.getWidth();
		int h = photo2.getHeight();
		int ww = watermarkBitmap.getWidth();

		Bitmap newBitmap = Bitmap.createBitmap(w, h, Config.ARGB_8888);
		Canvas cv = new Canvas(newBitmap);
		cv.drawBitmap(photo2, 0, 0, null);
		cv.drawBitmap(watermarkBitmap, w - ww, 0, null);
		cv.save(Canvas.ALL_SAVE_FLAG);
		cv.restore();
		return newBitmap;
	}
    public static Bitmap getBitmapOfCompress(String path,int maxNumOfPixels){
    	Bitmap returnBitmap = null;
    	File file = new File(path);
		if(file.exists()){
			
			BitmapFactory.Options opt = new BitmapFactory.Options();
			opt.inJustDecodeBounds = true;
			BitmapFactory.decodeFile(file.getPath(),opt);
			
			opt.inSampleSize = FileUtil.computeSampleSize(opt, -1, maxNumOfPixels);

			opt.inJustDecodeBounds = false;
			
			returnBitmap = BitmapFactory.decodeFile(file.getPath(),opt);
			
		}
    	
    	return returnBitmap;
    }
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static HashMap initMime() {
		HashMap mime = new HashMap();

		mime.put(".apk", "application/vnd.android.package-archive");
		mime.put(".3gp", "video/3gpp");
		mime.put(".aab", "application/x-authoware-");
		mime.put(".aam", "application/x-authoware-map");
		mime.put(".aas", "application/x-authoware-seg");
		mime.put(".ai", "application/postscript");
		mime.put(".aif", "audio/x-aiff");
		mime.put(".aifc", "audio/x-aiff");
		mime.put(".aiff", "audio/x-aiff");
		mime.put(".als", "audio/X-Alpha5");
		mime.put(".amc", "application/x-mpeg");
		mime.put(".ani", "application/octet-stream");
		mime.put(".asc", "text/plain");
		mime.put(".asd", "application/astound");
		mime.put(".asf", "video/x-ms-asf");
		mime.put(".asn", "application/astound");
		mime.put(".asp", "application/x-asap");
		mime.put(".asx", "video/x-ms-asf");
		mime.put(".au", "audio/basic");
		mime.put(".avb", "application/octet-stream");
		mime.put(".avi", "video/x-msvideo");
		mime.put(".awb", "audio/amr-wb");
		mime.put(".bcpio", "application/x-bcpio");
		mime.put(".bin", "application/octet-stream");
		mime.put(".bld", "application/bld");
		mime.put(".bld2", "application/bld2");
		mime.put(".bmp", "application/x-MS-bmp");
		mime.put(".bpk", "application/octet-stream");
		mime.put(".bz2", "application/x-bzip2");
		mime.put(".cal", "image/x-cals");
		mime.put(".ccn", "application/x-cnc");
		mime.put(".cco", "application/x-cocoa");
		mime.put(".cdf", "application/x-netcdf");
		mime.put(".cgi", "magnus-internal/cgi");
		mime.put(".chat", "application/x-chat");
		mime.put(".class", "application/octet-stream");
		mime.put(".clp", "application/x-msclip");
		mime.put(".cmx", "application/x-cmx");
		mime.put(".co", "application/x-cult3d-object");
		mime.put(".cod", "image/cis-cod");
		mime.put(".cpio", "application/x-cpio");
		mime.put(".cpt", "application/mac-compactpro");
		mime.put(".crd", "application/x-mscardfile");
		mime.put(".csh", "application/x-csh");
		mime.put(".csm", "chemical/x-csml");
		mime.put(".csml", "chemical/x-csml");
		mime.put(".css", "text/css");
		mime.put(".cur", "application/octet-stream");
		mime.put(".dcm", "x-lml/x-evm");
		mime.put(".dcr", "application/x-director");
		mime.put(".dcx", "image/x-dcx");
		mime.put(".dhtml", "text/html");
		mime.put(".dir", "application/x-director");
		mime.put(".dll", "application/octet-stream");
		mime.put(".dmg", "application/octet-stream");
		mime.put(".dms", "application/octet-stream");
		mime.put(".doc", "application/msword");
		mime.put(".dot", "application/x-dot");
		mime.put(".dvi", "application/x-dvi");
		mime.put(".dwf", "drawing/x-dwf");
		mime.put(".dwg", "application/x-autocad");
		mime.put(".dxf", "application/x-autocad");
		mime.put(".dxr", "application/x-director");
		mime.put(".ebk", "application/x-expandedbook");
		mime.put(".emb", "chemical/x-embl-dl-nucleotide");
		mime.put(".embl", "chemical/x-embl-dl-nucleotide");
		mime.put(".eps", "application/postscript");
		mime.put(".epub", "application/epub+zip");
		mime.put(".eri", "image/x-eri");
		mime.put(".es", "audio/echospeech");
		mime.put(".esl", "audio/echospeech");
		mime.put(".etc", "application/x-earthtime");
		mime.put(".etx", "text/x-setext");
		mime.put(".evm", "x-lml/x-evm");
		mime.put(".evy", "application/x-envoy");
		mime.put(".exe", "application/octet-stream");
		mime.put(".fh4", "image/x-freehand");
		mime.put(".fh5", "image/x-freehand");
		mime.put(".fhc", "image/x-freehand");
		mime.put(".fif", "image/fif");
		mime.put(".fm", "application/x-maker");
		mime.put(".fpx", "image/x-fpx");
		mime.put(".fvi", "video/isivideo");
		mime.put(".gau", "chemical/x-gaussian-input");
		mime.put(".gca", "application/x-gca-compressed");
		mime.put(".gdb", "x-lml/x-gdb");
		mime.put(".gif", "image/gif");
		mime.put(".gps", "application/x-gps");
		mime.put(".gtar", "application/x-gtar");
		mime.put(".gz", "application/x-gzip");
		mime.put(".hdf", "application/x-hdf");
		mime.put(".hdm", "text/x-hdml");
		mime.put(".hdml", "text/x-hdml");
		mime.put(".hlp", "application/winhlp");
		mime.put(".hqx", "application/mac-binhex40");
		mime.put(".htm", "text/html");
		mime.put(".html", "text/html");
		mime.put(".hts", "text/html");
		mime.put(".ice", "x-conference/x-cooltalk");
		mime.put(".ico", "application/octet-stream");
		mime.put(".ief", "image/ief");
		mime.put(".ifm", "image/gif");
		mime.put(".ifs", "image/ifs");
		mime.put(".imy", "audio/melody");
		mime.put(".ins", "application/x-NET-Install");
		mime.put(".ips", "application/x-ipscript");
		mime.put(".ipx", "application/x-ipix");
		mime.put(".it", "audio/x-mod");
		mime.put(".itz", "audio/x-mod");
		mime.put(".ivr", "i-world/i-vrml");
		mime.put(".j2k", "image/j2k");
		mime.put(".jad", "text/vnd.sun.j2me.app-descriptor");
		mime.put(".jam", "application/x-jam");
		mime.put(".jar", "application/java-archive");
		mime.put(".jnlp", "application/x-java-jnlp-file");
		mime.put(".jpe", "image/jpeg");
		mime.put(".jpeg", "image/jpeg");
		mime.put(".jpg", "image/jpeg");
		mime.put(".jpz", "image/jpeg");
		mime.put(".js", "application/x-javascript");
		mime.put(".jwc", "application/jwc");
		mime.put(".kjx", "application/x-kjx");
		mime.put(".lak", "x-lml/x-lak");
		mime.put(".latex", "application/x-latex");
		mime.put(".lcc", "application/fastman");
		mime.put(".lcl", "application/x-digitalloca");
		mime.put(".lcr", "application/x-digitalloca");
		mime.put(".lgh", "application/lgh");
		mime.put(".lha", "application/octet-stream");
		mime.put(".lml", "x-lml/x-lml");
		mime.put(".lmlpack", "x-lml/x-lmlpack");
		mime.put(".lsf", "video/x-ms-asf");
		mime.put(".lsx", "video/x-ms-asf");
		mime.put(".lzh", "application/x-lzh");
		mime.put(".m13", "application/x-msmediaview");
		mime.put(".m14", "application/x-msmediaview");
		mime.put(".m15", "audio/x-mod");
		mime.put(".m3u", "audio/x-mpegurl");
		mime.put(".m3url", "audio/x-mpegurl");
		mime.put(".ma1", "audio/ma1");
		mime.put(".ma2", "audio/ma2");
		mime.put(".ma3", "audio/ma3");
		mime.put(".ma5", "audio/ma5");
		mime.put(".man", "application/x-troff-man");
		mime.put(".map", "magnus-internal/imagemap");
		mime.put(".mbd", "application/mbedlet");
		mime.put(".mct", "application/x-mascot");
		mime.put(".mdb", "application/x-msaccess");
		mime.put(".mdz", "audio/x-mod");
		mime.put(".me", "application/x-troff-me");
		mime.put(".mel", "text/x-vmel");
		mime.put(".mi", "application/x-mif");
		mime.put(".mid", "audio/midi");
		mime.put(".midi", "audio/midi");
		mime.put(".mif", "application/x-mif");
		mime.put(".mil", "image/x-cals");
		mime.put(".mio", "audio/x-mio");
		mime.put(".mmf", "application/x-skt-lbs");
		mime.put(".mng", "video/x-mng");
		mime.put(".mny", "application/x-msmoney");
		mime.put(".moc", "application/x-mocha");
		mime.put(".mocha", "application/x-mocha");
		mime.put(".mod", "audio/x-mod");
		mime.put(".mof", "application/x-yumekara");
		mime.put(".mol", "chemical/x-mdl-molfile");
		mime.put(".mop", "chemical/x-mopac-input");
		mime.put(".mov", "video/quicktime");
		mime.put(".movie", "video/x-sgi-movie");
		mime.put(".mp2", "audio/x-mpeg");
		mime.put(".mp3", "audio/x-mpeg");
		mime.put(".mp4", "video/mp4");
		mime.put(".mpc", "application/vnd.mpohun.certificate");
		mime.put(".mpe", "video/mpeg");
		mime.put(".mpeg", "video/mpeg");
		mime.put(".mpg", "video/mpeg");
		mime.put(".mpg4", "video/mp4");
		mime.put(".mpga", "audio/mpeg");
		mime.put(".mpn", "application/vnd.mophun.application");
		mime.put(".mpp", "application/vnd.ms-project");
		mime.put(".mps", "application/x-mapserver");
		mime.put(".mrl", "text/x-mrml");
		mime.put(".mrm", "application/x-mrm");
		mime.put(".ms", "application/x-troff-ms");
		mime.put(".mts", "application/metastream");
		mime.put(".mtx", "application/metastream");
		mime.put(".mtz", "application/metastream");
		mime.put(".mzv", "application/metastream");
		mime.put(".nar", "application/zip");
		mime.put(".nbmp", "image/nbmp");
		mime.put(".nc", "application/x-netcdf");
		mime.put(".ndb", "x-lml/x-ndb");
		mime.put(".ndwn", "application/ndwn");
		mime.put(".nif", "application/x-nif");
		mime.put(".nmz", "application/x-scream");
		mime.put(".nokia-op-logo", "image/vnd.nok-oplogo-color");
		mime.put(".npx", "application/x-netfpx");
		mime.put(".nsnd", "audio/nsnd");
		mime.put(".nva", "application/x-neva1");
		mime.put(".oda", "application/oda");
		mime.put(".oom", "application/x-AtlasMate-Plugin");
		mime.put(".pac", "audio/x-pac");
		mime.put(".pae", "audio/x-epac");
		mime.put(".pan", "application/x-pan");
		mime.put(".pbm", "image/x-portable-bitmap");
		mime.put(".pcx", "image/x-pcx");
		mime.put(".pda", "image/x-pda");
		mime.put(".pdb", "chemical/x-pdb");
		mime.put(".pdf", "application/pdf");
		mime.put(".pfr", "application/font-tdpfr");
		mime.put(".pgm", "image/x-portable-graymap");
		mime.put(".pict", "image/x-pict");
		mime.put(".pm", "application/x-perl");
		mime.put(".pmd", "application/x-pmd");
		mime.put(".png", "image/png");
		mime.put(".pnm", "image/x-portable-anymap");
		mime.put(".pnz", "image/png");
		mime.put(".pot", "application/vnd.ms-powerpoint");
		mime.put(".ppm", "image/x-portable-pixmap");
		mime.put(".pps", "application/vnd.ms-powerpoint");
		mime.put(".ppt", "application/vnd.ms-powerpoint");
		mime.put(".pqf", "application/x-cprplayer");
		mime.put(".pqi", "application/cprplayer");
		mime.put(".prc", "application/x-prc");
		mime.put(".proxy", "application/x-ns-proxy-autoconfig");
		mime.put(".ps", "application/postscript");
		mime.put(".ptlk", "application/listenup");
		mime.put(".pub", "application/x-mspublisher");
		mime.put(".pvx", "video/x-pv-pvx");
		mime.put(".qcp", "audio/vnd.qcelp");
		mime.put(".qt", "video/quicktime");
		mime.put(".qti", "image/x-quicktime");
		mime.put(".qtif", "image/x-quicktime");
		mime.put(".r3t", "text/vnd.rn-realtext3d");
		mime.put(".ra", "audio/x-pn-realaudio");
		mime.put(".ram", "audio/x-pn-realaudio");
		mime.put(".rar", "application/x-rar-compressed");
		mime.put(".ras", "image/x-cmu-raster");
		mime.put(".rdf", "application/rdf+xml");
		mime.put(".rf", "image/vnd.rn-realflash");
		mime.put(".rgb", "image/x-rgb");
		mime.put(".rlf", "application/x-richlink");
		mime.put(".rm", "audio/x-pn-realaudio");
		mime.put(".rmf", "audio/x-rmf");
		mime.put(".rmm", "audio/x-pn-realaudio");
		mime.put(".rmvb", "audio/x-pn-realaudio");
		mime.put(".rnx", "application/vnd.rn-realplayer");
		mime.put(".roff", "application/x-troff");
		mime.put(".rp", "image/vnd.rn-realpix");
		mime.put(".rpm", "audio/x-pn-realaudio-plugin");
		mime.put(".rt", "text/vnd.rn-realtext");
		mime.put(".rte", "x-lml/x-gps");
		mime.put(".rtf", "application/rtf");
		mime.put(".rtg", "application/metastream");
		mime.put(".rtx", "text/richtext");
		mime.put(".rv", "video/vnd.rn-realvideo");
		mime.put(".rwc", "application/x-rogerwilco");
		mime.put(".s3m", "audio/x-mod");
		mime.put(".s3z", "audio/x-mod");
		mime.put(".sca", "application/x-supercard");
		mime.put(".scd", "application/x-msschedule");
		mime.put(".sdf", "application/e-score");
		mime.put(".sea", "application/x-stuffit");
		mime.put(".sgm", "text/x-sgml");
		mime.put(".sgml", "text/x-sgml");
		mime.put(".sh", "application/x-sh");
		mime.put(".shar", "application/x-shar");
		mime.put(".shtml", "magnus-internal/parsed-html");
		mime.put(".shw", "application/presentations");
		mime.put(".si6", "image/si6");
		mime.put(".si7", "image/vnd.stiwap.sis");
		mime.put(".si9", "image/vnd.lgtwap.sis");
		mime.put(".sis", "application/vnd.symbian.install");
		mime.put(".sit", "application/x-stuffit");
		mime.put(".skd", "application/x-Koan");
		mime.put(".skm", "application/x-Koan");
		mime.put(".skp", "application/x-Koan");
		mime.put(".skt", "application/x-Koan");
		mime.put(".slc", "application/x-salsa");
		mime.put(".smd", "audio/x-smd");
		mime.put(".smi", "application/smil");
		mime.put(".smil", "application/smil");
		mime.put(".smp", "application/studiom");
		mime.put(".smz", "audio/x-smd");
		mime.put(".snd", "audio/basic");
		mime.put(".spc", "text/x-speech");
		mime.put(".spl", "application/futuresplash");
		mime.put(".spr", "application/x-sprite");
		mime.put(".sprite", "application/x-sprite");
		mime.put(".sdp", "application/sdp");
		mime.put(".spt", "application/x-spt");
		mime.put(".src", "application/x-wais-source");
		mime.put(".stk", "application/hyperstudio");
		mime.put(".stm", "audio/x-mod");
		mime.put(".sv4cpio", "application/x-sv4cpio");
		mime.put(".sv4crc", "application/x-sv4crc");
		mime.put(".svf", "image/vnd");
		mime.put(".svg", "image/svg-xml");
		mime.put(".svh", "image/svh");
		mime.put(".svr", "x-world/x-svr");
		mime.put(".swf", "application/x-shockwave-flash");
		mime.put(".swfl", "application/x-shockwave-flash");
		mime.put(".t", "application/x-troff");
		mime.put(".tad", "application/octet-stream");
		mime.put(".talk", "text/x-speech");
		mime.put(".tar", "application/x-tar");
		mime.put(".taz", "application/x-tar");
		mime.put(".tbp", "application/x-timbuktu");
		mime.put(".tbt", "application/x-timbuktu");
		mime.put(".tcl", "application/x-tcl");
		mime.put(".tex", "application/x-tex");
		mime.put(".texi", "application/x-texinfo");
		mime.put(".texinfo", "application/x-texinfo");
		mime.put(".tgz", "application/x-tar");
		mime.put(".thm", "application/vnd.eri.thm");
		mime.put(".tif", "image/tiff");
		mime.put(".tiff", "image/tiff");
		mime.put(".tki", "application/x-tkined");
		mime.put(".tkined", "application/x-tkined");
		mime.put(".toc", "application/toc");
		mime.put(".toy", "image/toy");
		mime.put(".tr", "application/x-troff");
		mime.put(".trk", "x-lml/x-gps");
		mime.put(".trm", "application/x-msterminal");
		mime.put(".tsi", "audio/tsplayer");
		mime.put(".tsp", "application/dsptype");
		mime.put(".tsv", "text/tab-separated-values");
		mime.put(".tsv", "text/tab-separated-values");
		mime.put(".ttf", "application/octet-stream");
		mime.put(".ttz", "application/t-time");
		mime.put(".txt", "text/plain");
		mime.put(".ult", "audio/x-mod");
		mime.put(".ustar", "application/x-ustar");
		mime.put(".uu", "application/x-uuencode");
		mime.put(".uue", "application/x-uuencode");
		mime.put(".vcd", "application/x-cdlink");
		mime.put(".vcf", "text/x-vcard");
		mime.put(".vdo", "video/vdo");
		mime.put(".vib", "audio/vib");
		mime.put(".viv", "video/vivo");
		mime.put(".vivo", "video/vivo");
		mime.put(".vmd", "application/vocaltec-media-desc");
		mime.put(".vmf", "application/vocaltec-media-file");
		mime.put(".vmi", "application/x-dreamcast-vms-info");
		mime.put(".vms", "application/x-dreamcast-vms");
		mime.put(".vox", "audio/voxware");
		mime.put(".vqe", "audio/x-twinvq-plugin");
		mime.put(".vqf", "audio/x-twinvq");
		mime.put(".vql", "audio/x-twinvq");
		mime.put(".vre", "x-world/x-vream");
		mime.put(".vrml", "x-world/x-vrml");
		mime.put(".vrt", "x-world/x-vrt");
		mime.put(".vrw", "x-world/x-vream");
		mime.put(".vts", "workbook/formulaone");
		mime.put(".wav", "audio/x-wav");
		mime.put(".wax", "audio/x-ms-wax");
		mime.put(".wbmp", "image/vnd.wap.wbmp");
		mime.put(".web", "application/vnd.xara");
		mime.put(".wi", "image/wavelet");
		mime.put(".wis", "application/x-InstallShield");
		mime.put(".wm", "video/x-ms-wm");
		mime.put(".wma", "audio/x-ms-wma");
		mime.put(".wmd", "application/x-ms-wmd");
		mime.put(".wmf", "application/x-msmetafile");
		mime.put(".wml", "text/vnd.wap.wml");
		mime.put(".wmlc", "application/vnd.wap.wmlc");
		mime.put(".wmls", "text/vnd.wap.wmlscript");
		mime.put(".wmlsc", "application/vnd.wap.wmlscriptc");
		mime.put(".wmlscript", "text/vnd.wap.wmlscript");
		mime.put(".wmv", "video/x-ms-wmv");
		mime.put(".wmx", "video/x-ms-wmx");
		mime.put(".wmz", "application/x-ms-wmz");
		mime.put(".wpng", "image/x-up-wpng");
		mime.put(".wpt", "x-lml/x-gps");
		mime.put(".wri", "application/x-mswrite");
		mime.put(".wrl", "x-world/x-vrml");
		mime.put(".wrz", "x-world/x-vrml");
		mime.put(".ws", "text/vnd.wap.wmlscript");
		mime.put(".wsc", "application/vnd.wap.wmlscriptc");
		mime.put(".wv", "video/wavelet");
		mime.put(".wvx", "video/x-ms-wvx");
		mime.put(".wxl", "application/x-wxl");
		mime.put(".x-gzip", "application/x-gzip");
		mime.put(".xar", "application/vnd.xara");
		mime.put(".xbm", "image/x-xbitmap");
		mime.put(".xdm", "application/x-xdma");
		mime.put(".xdma", "application/x-xdma");
		mime.put(".xdw", "application/vnd.fujixerox.docuworks");
		mime.put(".xht", "application/xhtml+xml");
		mime.put(".xhtm", "application/xhtml+xml");
		mime.put(".xhtml", "application/xhtml+xml");
		mime.put(".xla", "application/vnd.ms-excel");
		mime.put(".xlc", "application/vnd.ms-excel");
		mime.put(".xll", "application/x-excel");
		mime.put(".xlm", "application/vnd.ms-excel");
		mime.put(".xls", "application/vnd.ms-excel");
		mime.put(".xlt", "application/vnd.ms-excel");
		mime.put(".xlw", "application/vnd.ms-excel");
		mime.put(".xm", "audio/x-mod");
		mime.put(".xml", "text/xml");
		mime.put(".xmz", "audio/x-mod");
		mime.put(".xpi", "application/x-xpinstall");
		mime.put(".xpm", "image/x-xpixmap");
		mime.put(".xsit", "text/xml");
		mime.put(".xsl", "text/xml");
		mime.put(".xul", "text/xul");
		mime.put(".xwd", "image/x-xwindowdump");
		mime.put(".xyz", "chemical/x-pdb");
		mime.put(".yz1", "application/x-yz1");
		mime.put(".z", "application/x-compress");
		mime.put(".zac", "application/x-zaurus-zac");
		mime.put(".zip", "application/zip");
		return mime;
	}
}
